package com.chuyu.jzwboa.presenter.launcher;

import com.chuyu.jzwboa.model.imodel.launcher.ILoginModel;
import com.chuyu.jzwboa.model.models.launcher.LoginModel;
import com.chuyu.jzwboa.view.iview.launcher.ILgoinView;
import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;

/**
 * @author
 * @description 登录
 * Created by wo on 2017/12/14.
 */

public class LoginPresnter extends MvpBasePresenter<ILgoinView>{


    public void StartLogin(String username,String password){
        if (isViewAttached()){

        }else{
            return;
        }
        final ILgoinView view = getView();

        view.showPorgressBar();

        LoginModel.getInstance().startLogin(username, password, new ILoginModel.OnLoginListener() {
            @Override
            public void loginSuccess() {
                view.closePorfressBar();
                view.loginSuccess();
            }

            @Override
            public void loginFaile() {
                view.closePorfressBar();
                view.loginFaile();
            }

            @Override
            public void loginException() {
                view.closePorfressBar();
                view.showLoginExpetion("");
            }
        });


    }
}
